var t = getApp();

Page({
    data: {
        language: "",
        list: [],
        info: {},
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        this.getTitle(), this.getStoreInfo(), this.getData();
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.data.isLoadMore ? this.getMoreData() : wx.showToast({
            title: "没有更多数据",
            icon: "none"
        });
    },
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getTitle: function() {
        var e = t.getNetAddresss("plugin.share-chain.frontend.plugin-name.index");
        t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 === e.result ? wx.setNavigationBarTitle({
                    title: e.data.plugin_name ? e.data.plugin_name : ""
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getStoreInfo: function() {
        var e = this, a = t.getNetAddresss("plugin.share-chain.frontend.process.index");
        a += "&source_code=" + this.options.source_code + "&queue_id=" + this.options.queue_id, 
        t._getNetWork({
            url: a,
            success: function(t) {
                var a = t.data;
                1 === a.result ? e.setData({
                    info: a.data
                }) : wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 1500,
                    success: function() {
                        setTimeout(function() {
                            wx.reLaunch({
                                url: "/packageG/pages/member/extension/extension"
                            });
                        }, 1500);
                    }
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getData: function() {
        var e = this, a = t.getNetAddresss("plugin.share-chain.frontend.process.getList");
        a += "&source_code=" + this.options.source_code + "&queue_id=" + this.options.queue_id, 
        t._getNetWork({
            url: a,
            success: function(t) {
                var a = t.data;
                1 === a.result ? e.setData({
                    list: a.data.data
                }) : wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 1500,
                    success: function() {
                        setTimeout(function() {
                            wx.reLaunch({
                                url: "/packageG/pages/member/extension/extension"
                            });
                        }, 1500);
                    }
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var e = this;
        if (this.setData({
            isLoadMore: !1
        }), !(this.data.page >= this.data.total_page)) {
            var a = this.data.page + 1;
            this.setData({
                page: a
            });
            var o = t.getNetAddresss("plugin.share-chain.frontend.process.getList");
            o += "&source_code=" + this.options.source_code + "&queue_id=" + this.options.queue_id, 
            t._getNetWork({
                url: o,
                success: function(t) {
                    var a = t.data;
                    if (1 === a.result) {
                        var o = e.data.list.concat(a.data.data);
                        e.setData({
                            list: o
                        });
                    } else {
                        var n = e.data.page - 1;
                        e.setData({
                            page: n,
                            isLoadMore: !1
                        });
                    }
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    }
});